
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>解释一下AMQP协议的工作原理吗？ - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>解释一下AMQP协议的工作原理吗？ - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">AMQP（高级消息队列协议）的设计目标是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">AMQP 的设计目标是提供一种可靠、可扩展、并且能够保证消息传递的协议，主要用于在分布式系统中进行消息的发布、路由、队列和消费。</div>
          </div>
          <div class="card-source">来源: 文档开篇部分</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">组件</div>
          <div class="card-question">AMQP 协议模型包含哪五个核心组件？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">组件</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">AMQP 的核心组件包括：生产者（Producer）、消费者（Consumer）、交换机（Exchange）、队列（Queue）和绑定（Binding）。</div>
          </div>
          <div class="card-source">来源: 1. 协议模型</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">在 AMQP 中，交换机（Exchange）的作用是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">交换机（Exchange）负责接收生产者发送的消息，并根据预定义的规则（通过绑定定义）将消息路由到一个或多个队列。</div>
          </div>
          <div class="card-source">来源: 1. 协议模型</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">AMQP 中提到的四种交换机类型及其路由方式分别是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">1. 直接交换机：根据消息的路由键直接路由。2. 主题交换机：根据路由键模式匹配多个队列。3. 分裂交换机：将消息广播到所有绑定的队列。4. 扇出交换机：将消息发送到所有绑定的队列，不考虑路由键。</div>
          </div>
          <div class="card-source">来源: 2. 消息传递过程 - 消息路由</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">在 AMQP 连接中为什么要使用频道（Channel）？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">频道是消息传递的逻辑通道，用于在单一的 TCP/IP 连接上处理多个消息流，从而减少网络开销。</div>
          </div>
          <div class="card-source">来源: 2. 消息传递过程 - 频道（Channel）创建</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">消费者在消费消息时，自动确认（auto ACK）和手动确认（manual ACK）有什么区别？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">自动确认是指消息在被发送到消费者后立即被认为是已处理。手动确认则需要消费者在处理完消息后，显式地向服务器发送确认来标记消息已成功处理。</div>
          </div>
          <div class="card-source">来源: 2. 消息传递过程 - 消息消费</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">AMQP 如何通过消息确认机制来保证消息不丢失？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">消费者在成功消费消息后，向 AMQP 服务器发送确认。如果消费者在处理消息时发生故障，未被确认的消息可以被重新排队，从而确保消息不会丢失。</div>
          </div>
          <div class="card-source">来源: 2. 消息传递过程 - 消息确认与事务</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">什么是死信队列（Dead-Letter Queue），它在 AMQP 中有什么作用？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">当消息无法被成功路由或处理时，可以将其转发到死信交换机，再进入死信队列。这为处理失败的消息提供了进一步处理或进行审计的机制。</div>
          </div>
          <div class="card-source">来源: 3. 错误处理和重试</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">AMQP 中的持久队列（persistent queue）和临时队列（temporary queue）有什么不同？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">持久队列在服务重启后会保留其中存储的消息，而临时队列在服务重启后会消失。</div>
          </div>
          <div class="card-source">来源: 2. 消息传递过程 - 消息存储</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
